main(){
  // 1. 实例化子类
  Alipay alipay = Alipay();
  alipay.pay(100);

  // 2. 实例化子类
  WechatPay wechatPay = WechatPay();
  wechatPay.pay(200);

  // 3. 实例化子类
  UnionPay unionPay = UnionPay();
  unionPay.pay(300);

}

abstract class Payment{
  // 抽象方法
  void pay(double amount);
}

class Alipay implements Payment{
  @override
  void pay(double amount) {
    print('支付宝支付了$amount元');
  }
}

class WechatPay implements Payment{
  @override
  void pay(double amount) {
    print('微信支付了$amount元');
  }
}

class UnionPay implements Payment{
  @override
  void pay(double amount) {
    print('银联支付了$amount元');
  }
}


